From dd2cf9dfee5c95b0f7cbd79aaa7643a3da2097cf Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 2 Jun 2011 00:04:58 +0000 Subject: [PATCH] Actually use lat AND lon (blush) when computingn distance in track filter. Use sensible thresholds. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4066 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/trackfilter.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gpsbabel/trackfilter.c b/gpsbabel/trackfilter.c index 1e47ec3bf..4344b83fd 100644 --- a/gpsbabel/trackfilter.c +++ b/gpsbabel/trackfilter.c @@ -1087,9 +1087,16 @@ trackfilter_points_are_same(const waypoint *wpta, const waypoint *wptb) { // We use a simpler (non great circle) test for lat/lon here as this // is used for keeping the 'bookends' of non-moving points. + // + // Latitude spacing is about 27 feet per .00001 degree. + // Longitude spacing varies, but the reality is that anything closer + // than 27 feet does little but clutter the output. + // As this is about the limit of consumer grade GPS, it seems a + // reasonable tradeoff. + return - abs(wpta->latitude - wptb->latitude) < .0000001 && - abs(wpta->latitude - wptb->latitude) < .0000001 && + fabs(wpta->latitude - wptb->latitude) < .00001 && + fabs(wpta->longitude - wptb->longitude) < .00001 && abs(wpta->altitude - wptb->altitude) < 20 && (WAYPT_HAS(wpta,course) == WAYPT_HAS(wptb,course)) && (wpta->course == wptb->course) && -- 2.30.2